import Mock from "mockjs"
const Random = Mock.Random;

export default {
    '/api/type': () => {
        return {
            code: 0,
            data: [
                {
                    id: '1', name: '前端', children: [
                        { id: '1-1', name: 'JavaScript' },
                        { id: '1-2', name: 'CSS' },
                        { id: '1-3', name: '框架' },
                        { id: '1-4', name: 'Node.js' },
                        { id: '1-5', name: '其他' }
                    ]
                },
                {
                    id: '2', name: '后端', children: [
                        { id: '2-1', name: 'Java' },
                        { id: '2-2', name: '其他' }
                    ]
                },
                {
                    id: "3", name: '运维', children: [
                        { id: '3-1', name: 'Linux' },
                        { id: '3-2', name: '其他' }
                    ]
                },
                {
                    id: '4', name: '其他', children: [
                        { id: '4-1', name: 'git' },
                    ]
                }
            ]
        }
    },
    '/api/list': () => {
        const data = Mock.mock({
            'data|5': [{
                id: () => Random.guid(),
                title: () => Random.csentence(5, 10),
                content: () => Random.csentence(70, 100),
                time: () => Random.datetime()
            }],
        })
        return {
            code: 0,
            data: {
                data: data.data,
                total: 36
            }
        }
    },
    '/api/detail': () => {
        const data = Mock.mock({
            time: () => Random.datetime(),
            content: () => Random.csentence(100),
            id: () => Random.guid()
        })
        return {
            code: 0,
            data
        }
    }
}